﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CloudPms.Logic.Business
{
    /// <summary>
    /// 房间处理
    /// <para>--------------------------</para>
    /// <para>@Author: cnalexi@gmail.com</para> 
    /// <para>@Create: 2012/10/22</para>  
    /// </summary>
    public class RoomService
    {
        #region ☆ -------- 房态查询 -------- ☆

        /// <summary>
        /// 检查控房状态
        /// </summary>
        /// <param name="hotelId"></param>
        /// <param name="roomNo"></param>
        /// <param name="beginDate"></param>
        /// <param name="endDate"></param>
        /// <returns>房间在该期间内的空房情况，如果为empty则为空房可住</returns>
        public string CheckVacancy(string hotelId, string roomNo, DateTime beginDate, DateTime endDate)
        {
            if (string.IsNullOrWhiteSpace(hotelId) || string.IsNullOrWhiteSpace(roomNo))
            {
                throw new ArgumentException("入住、订单排房、维修时房号不能为空");
            }

            //获取期间内的房控
            
            //var occupy = .GetRoomOccupy(hotelId, roomNo, beginDate, endDate);

            //if (occupy != null)
            //{
            //    string orderId = occupy.ResvID ?? occupy.OrderId;
            //    throw new FaultException(string.Format("订单入住时间范围所选房间{0}已经被 另外的订单 {1} 排房 或 入住 或 维修，请检查", roomNo, orderId));
            //}

            return null;
        }

        #endregion

        #region ☆ -------- 房态变更 -------- ☆

        public void LockRoom(string hotelId, string roomNo, string reason)
        {

        }

        public void CancelLockRoom(string hotelId, string roomNo)
        {

        }

        public void SetOutOfOrderRoom(string hotelId, string roomNo, string reason, DateTime beginDate, DateTime endDate)
        {
        }

        public void CancelOutOfOrderRoom(string hotelId, string roomNo)
        {
        }

        public void SetRoomStatus(string hotelId, string roomNo,string oldStatus,string newStatus)
        {
            //当OriginStatus=null时则从数据库获取原房态
        }
        
        #endregion

        #region ☆ -------- 统计信息 -------- ☆

        //房量等等
        #endregion

    }
}
